<include file="Public/header"/>
<div class="x-nav">
      <span class="layui-breadcrumb">

      </span>
  <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href);" title="刷新">
    <i class="layui-icon" style="line-height:30px">ဂ</i></a>
</div>
<div class="x-body">
  <div class="layui-row">
    <form class="layui-form layui-col-md12 x-so"  method="get">

      <div class="layui-input-inline">
        <select name="activity" cstyle="margin-top:10px;">
          <option value="0" <php>if(I("activity")==0) echo 'selected' </php>>选择活动</option>
          <foreach name="activity" item="v">
          <option value="{$v.id}" <if condition='$v["id"] eq I("activity")'>selected</if> >{$v.name}</option>
          </foreach>
        </select>
      </div>
      <button class="layui-btn" id="search"  lay-submit="" lay-filter="sreach"><i class="layui-icon">&#xe615;</i></button>
      <button class="layui-btn" id="export"  lay-submit="" lay-filter="" ><i class="layui-icon">&#xe62f;</i>打印到终端</button>
      <button class="layui-btn" id="orderprint"  lay-submit="" lay-filter="" ><i class="layui-icon">&#xe62f;</i>订单导出</button>
      <!--  <button class="layui-btn" id="export_test"  lay-submit="" lay-filter="" ><i class="layui-icon">&#xe62f;</i>测试_导出表格</button>-->
    </form>
  </div>
  <xblock style="height:38px;line-height:38px;">
    <span class="x-right" style="line-height:40px">商品明细</span>
  </xblock>
<table class="layui-table">
<tr>
	<th style="width:30%">商品名称</th>
	<th style="width:10%">商品数量</th>
 	<th ></th>
 </tr>
 <foreach name="goods" item="v">
 <tr>
 	<td>{$v.name}</td>
 	<td>{$v.num}</td>
 	<td></td>
 </tr>
 </foreach>
</table>
<if condition="count($tuanzhang) gt 0">
  <xblock style="height:38px;line-height:38px;">
    <span class="x-right" style="line-height:40px">总团长明细</span>
  </xblock>
<table class="layui-table">
<tr>
	<th style="width:30%">总团长信息</th>
	<th style="width:10%">商品总数量</th>
 	<th ></th>
 </tr>
 <foreach name="tuanzhang" item="v">
 <tr>
 	<td>{$v.info}</td>
 	<td>{$v.num}</td>
 	<td></td>
 </tr>
<tr>
	<td colspan="3">
		<table class="layui-table">
			 <tr>
		 	<th style="width:30%">商品名称</th>
		 	<th style="width:10%">商品数量</th>
			 	<th ></th>
			 </tr>
			 <foreach name="v.goodsid" item="y">
			 <tr>
			 	<td>{$y.name}</td>
			 	<td>{$y.num}</td>
			 	<td></td>
			 </tr>
			 </foreach>
			</table>
		</td>
</tr>
 </foreach>
</table>
</if>
  <xblock style="height:38px;line-height:38px;">
    <span class="x-right" style="line-height:40px">配货明细</span>
  </xblock>  
  <table class="layui-table">
	<thead>
    <tr>
      <th>线路</th>
      <th>商品总数量</th>
      <th>线路小区数量</th>
    </tr>
    </thead>
    <tbody>
    <volist name="quyu" id="vo" key="k">
	      <tr bgcolor="#D8D8D8">
				<td>{$k}、{$vo["name"]}</td>
				<td>{$vo["num"]}</td>
				<td><php>echo count($vo["xiaoqu"])</php></td>
		 </tr>
		 <tr><td colspan="3">
	 			<table class="layui-table">
	 				 <tr>
					 	<th style="width:30%">商品名称</th>
					 	<th style="width:10%">商品总数量</th>
					 	<th ></th>
					 </tr>
					 <foreach name="vo.goodsid" item="y">
					 <tr>
					 	<td>{$y.name}</td>
					 	<td>{$y.num}</td>
					 	<td></td>
					 </tr>
					 </foreach>
	 			</table>				
		 </td></tr>
		 <tr><td colspan="3">
		 	<table class="layui-table">
				 <tr bgcolor="#F2F2F2">
				 	<th style="width:15%">小区名称</th>
				 	<th style="width:10%">团长姓名</th>
				 	<th style="width:10%">团长手机号</th>
				 	<th style="width:20%">团长地址</th>
				 	<th style="width:10%">商品总数量</th>
				 	<th style="width:20%">总团长</th>
				 	<th ></th>
				 </tr>
				 <foreach name="vo.xiaoqu" item="v">
				 <tr>
				 	<td>{$v.xiaoqu_name}</td>
				 	<td>{$v.tuan_name}</td>
				 	<td>{$v.mobile}</td>
				 	<td>{$v.address}</td>
				 	<td>{$v.num}</td>
				 	<td>{$v.flag}</td>
				 	<td></td>
				 </tr>
				 <tr>
				 		<td colspan="7">
				 			<table class="layui-table">
				 				 <tr>
								 	<th style="width:30%">商品名称</th>
								 	<th style="width:10%">商品数量</th>
								 	<th ></th>
								 </tr>
								 <foreach name="v.goodsid" item="y">
								 <tr>
								 	<td>{$y.name}</td>
								 	<td>{$y.num}</td>
								 	<td></td>
								 </tr>
								 </foreach>
				 			</table>
				 		</td>
				 </tr>
				 </foreach>
			 </table>
		 
		 </td></tr>
	</volist>
	</tbody>
</table>
</div>
<script>
$(function () {
    var searchurl = "{:U('index')}";
    $('#search').click(function () {

        $('form').attr('action',searchurl);
    });

    var exporturl = "{:U('exportprint')}";
    
    $('#export').click(function () {

        $('form').attr('action',exporturl);
    });
    
    var exporttest = "{:U('orderprint')}";
    
    $('#orderprint').click(function () {

        $('form').attr('action',exporttest);
    });    
})
</script>
<include file="Public/footer"/>